<%@ page pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<isperp:incidentView>
	<jsp:body> 
<div class="box  no-border">
	<table class="form-table">
		<tr>
			<td colspan="4">
				<div class="header">
					<h3>
						事件信息（<label class="important-info">${model.icdCategoryName}</label>）
						<c:if test="${not empty model.deadline }">
						（截止日期：<label class="important-info"><fmt:formatDate
											value="${model.deadline}" pattern="yyyy-MM-dd HH:mm" /> </label>）</c:if>
					</h3>
					（<a class="proce-node-current" id="a_showInfo" onclick="showInfo()">显示完整信息</a>）
				</div>
			</td>
		</tr>
		
		<tr id="frm_sh0">
			<td class="td1">所属大区：</td>
			<td class="td2">${model.area}</td>
		</tr>
		
		<tr id="frm_sh1">
			<td class="td1">请求人：</td>
			<td class="td2">${cusUser.fullname}<span id="requestExInfo"></span>
					</td>
			<td class="td1">请求人部门：</td>
			<td class="td2">${cusUser.department_name}</td>
		</tr>
		<tr id="frm_sh2">
			<td class="td1">联系人：</td>
			<td class="td2">${model.linkmanName}</td>
			<td class="td1">联系电话：</td>
			<td class="td2">${model.linkmanPhone}</td>
		</tr>
		<tr id="frm_sh3">
			<td class="td1">事件描述：</td>
			<td class="td2" colspan="3"><label><pre>${model.description}</pre>
			</label>
			</td>
		</tr>

        <tr id="frm_hd0">
			<td class="td1">所属大区：</td>
			<td class="td2">${model.area}</td>
		</tr>
		<tr id="frm_hd1" style="display:none">
			<td class="td1">请求人：</td>
			<td class="td2">${cusUser.fullname}<span id="requestExInfo"></span>
					</td>
			<td class="td1">请求人部门：</td>
			<td class="td2">${cusUser.department_name}</td>
		</tr>
		<tr id="frm_hd2" style="display:none"> 
			<td class="td1">联系人：</td>
			<td class="td2">${model.linkmanName}</td>
			<td class="td1">联系电话：</td>
			<td class="td2">${model.linkmanPhone}</td>
		</tr>
		<tr id="frm_hd3" style="display:none">
			<td class="td1">来源：</td>
			<td class="td2">${model.source}</td>

			</td>
			<td class="td1">创建时间：</td>
			<td class="td2"><fmt:formatDate value="${model.createDate}"
							pattern="yyyy-MM-dd HH:mm" />
					</td>
		</tr>

		<tr id="frm_hd4" style="display:none">
			<td class="td1">事件性质：</td>
			<td class="td2">${model.incidentType }</td>
			<td class="td1">发生时间：</td>
			<td class="td2"><fmt:formatDate value="${model.happenTime}"
							pattern="yyyy-MM-dd HH:mm" />
		
				
				
				
				</tr>
		<tr id="frm_hd5" style="display:none">
			<td class="td1">事件标题：</td>
			<td class="td2">${model.title}</td>
			</td>
			<td class="td1">期望完成时间：</td>
			<td class="td2"><fmt:formatDate value="${model.expectTime}"
							pattern="yyyy-MM-dd" />
					</td>
		</tr>
		<tr id="frm_hd6" style="display:none">
			<td class="td1">事件描述：</td>
			<td class="td2" colspan="3"><label><pre>${model.description}</pre>
			</label>
					</td>
		</tr>
		<tr id="frm_hd7" style="display:none">
			<td class="td1">服务目录：</td>
			<td class="td2"><isperp:relationLabel id="serviceCategoryId"
							idValue="${model.serviceCategoryId }" displayColumn="name"
							moduleUrl="serviceCatalog/service"></isperp:relationLabel>
					</td>
			<td class="td1">关联项目：</td>
			<td class="td2"><isperp:relationLabel id="projectId"
							idValue="${model.projectId }" displayColumn="name"
							moduleUrl="project/project"></isperp:relationLabel>
					</td>

		</tr>
		<tr>
			<td class="td1">附件：</td>
			<td class="td2" colspan="3"><isperp:uploader
							sourceId="${model.id }" id="incidentFiles" readonly="true"></isperp:uploader>
			</td>
		</tr>



	</table>
</div>



<form:form id="incidentForm" commandName="model" cssClass="validate"
			action="incident/incident/save">
	<form:hidden path="id" />
	<form:hidden path="confirmtimemanId"/>
	<form:hidden path="icdCategoryId" />
	 
<jsp:include page="../incidentProperty.jsp"></jsp:include>

</form:form>
		<br></br>


</jsp:body>
</isperp:incidentView>
<script type="text/javascript">
	function showInfo() {
		var t = $("#a_showInfo").html();
		if (t == "显示简要信息") {
			$("[id^='frm_hd']").hide();
			$("[id^='frm_sh']").show();
			$("#a_showInfo").html("显示完整信息");
		} else if (t == "显示完整信息") {
			$("[id^='frm_hd']").show();
			$("[id^='frm_sh']").hide();
			$("#a_showInfo").html("显示简要信息");
		}

	}
	$(function() {
		$("#closeWinBtn").hide();
	});
</script>
<isperp:buttonList>

	<isperp:processButtons processKey="incidentProcess" viewOnly="false"
		autoEntryNext="false" formId="incidentForm"
		beforeSubmit="function c(name){return check(name);}"
		processId="${model.processId }" businessKey="${model.id }"></isperp:processButtons>

</isperp:buttonList>
<script type="text/javascript">
    var ifHadChecked=false;
	function check(name) {
		//如果下一处理步骤选择“”，并且没有关联已关闭的问题反馈流程，则提示关联流程
		if (name.indexOf("转交其他综管审核")>-1 && !ifHadChecked) {
			openChoseNextStepUserWindow();
		} else{
            return true;
		}
	}
	
	function openChoseNextStepUserWindow() {
	    result = $("#incidentForm").valid();
	    if(!result)
	       return false;
	    var categoryId ='${model.icdCategoryId}';
		isperp.openDialog({
			id : "nextStepUserDialog",
			onThisWindow : true,
			contentUrl : 'workflow/processRun/beginSubEdit?categoryId=' + categoryId,
			title : "选择处理人",
			width : 600,
			height : 520,
			buttons : [ {
				text : "提交",
				"class" : 'nui-mainbtn',
				click : function() {
					var winObj = $("#nextStepUserDialog").find("iframe")[0].contentWindow;
					var userName = winObj.getSelectedValue();
					var suggestion = winObj.document.getElementById("suggestion").value;
					
					if (userName == "" || userName==undefined) {
						isperp.alert("请选择下一步处理人！");
						return false;
					}else
					{
					    $("#confirmtimemanId").val(userName);
					}
					ifHadChecked=true;
					$(this).wijdialog("close");
					$("#sbBtn").hide();
					$("[data-name='转交其他综管审核']").attr("data-suggestion", suggestion);
					$("[data-name='转交其他综管审核']").click();
					//$(this).wijdialog("close");
				}
			}, {
				text : "关闭",
				"class" : 'grey',
				click : function() {
					$(this).wijdialog("close");
				}
			} ]
		});
		return false;
	}
</script>


